<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('疫情防控信息收集列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>填报日期：</label>
                                <input type="text" name="belongDate" th:value="${belongDate}"/>
                            </li>
                            <li>
                                <label>部门ID：</label>
                                <input name="deptId" type="hidden" id="treeId"/>

                                 <input name="deptName" onclick="selectDeptTree()" id="treeName" type="text" placeholder="请点击选择部门"  >

                            </li>
                            <li>
                                <label>用户名称：</label>
                                <input type="text" name="userName"/>
                            </li>
                            <li>
                                <label>安康码：</label>
                                <select name="akmStatus" th:with="type=${@dict.getType('akm_status')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>核酸结果：</label>
                                <select name="hsResult" th:with="type=${@dict.getType('hs_result')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>行程码：</label>
                                <select name="xcmIsLeave" th:with="type=${@dict.getType('sys_yes_no')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>体温：</label>
                                <select name="twIsNormal" th:with="type=${@dict.getType('sys_yes_no')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="epidemic:collect:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="epidemic:collect:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="epidemic:collect:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="epidemic:collect:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('epidemic:collect:edit')}]];
        var removeFlag = [[${@permission.hasPermi('epidemic:collect:remove')}]];
        var collectTypeDatas = [[${@dict.getType('collect_type')}]];
        var userTypeDatas = [[${@dict.getType('user_type')}]];
        var akmStatusDatas = [[${@dict.getType('akm_status')}]];
        var hsResultDatas = [[${@dict.getType('hs_result')}]];
        var xcmIsLeaveDatas = [[${@dict.getType('sys_yes_no')}]];
        var twIsNormalDatas = [[${@dict.getType('sys_yes_no')}]];
        var aduitStatusDatas = [[${@dict.getType('aduit_status')}]];
        var prefix = ctx + "wxcp/epidemic/collect";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "疫情防控信息收集",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: 'ID',
                    visible: false
                },
                {
                    field: 'userId',
                    title: '工号'
                },
                {
                    field: 'deptName',
                    title: '部门'
                },

                {
                    field: 'userType',
                    title: '人员类型',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(userTypeDatas, value);
                    }
                },
                {
                    field: 'userName',
                    title: '用户名称'
                },
                {
                    field: 'phonenumber',
                    title: '手机号码'
                },
                {
                    field: 'akmStatus',
                    title: '安康码状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(akmStatusDatas, value);
                    }
                },

                {
                    field: 'hsTime',
                    title: '核酸检测时间'
                },
                {
                    field: 'hsResult',
                    title: '两日内核酸检测结果',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(hsResultDatas, value);
                    }
                },

                {
                    field: 'xcmIsLeave',
                    title: '行程码14天是否未离肥',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(xcmIsLeaveDatas, value);
                    }
                },


                {
                    field: 'twIsNormal',
                    title: '体温是否正常',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(twIsNormalDatas, value);
                    }
                },

                {
                    field: 'aduitStatus',
                    title: '审核状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(aduitStatusDatas, value);
                    }
                },
                {
                    field: 'aduitTime',
                    title: '审核时间'
                },
                {
                    field: 'aduitBy',
                    title: '审核人'
                },
                {
                    field: 'belongDate',
                    title: '所属核查日期'
                },

                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });



        /* 用户管理-新增-选择部门树 */
        function selectDeptTree() {
        	var treeId = $("#treeId").val();
        	var deptId = $.common.isEmpty(treeId) ? "1" : $("#treeId").val();
        	var url = ctx + "epidemic/dept/selectDeptTree/" + deptId;
			var options = {
				title: '选择部门',
				width: "380",
				url: url,
				callBack: doSubmit
			};
			$.modal.openOptions(options);

		}

		function doSubmit(index, layero){
			var tree = layero.find("iframe")[0].contentWindow.$._tree;
			var body = $.modal.getChildFrame(index);
   			$("#treeId").val(body.find('#treeId').val());
   			$("#treeName").val(body.find('#treeName').val());
   			$.modal.close(index);
            var deptId = $("#treeId").val();
            getUserList(deptId);
		}
    </script>
</body>
</html>
